<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box"></div>
    <script>
        var obj = {}
        Object.defineProperty(obj, 'name', {
            get() {
                console.log('get被调用了')
                return box.innerHTML
            },
            set(value) {
                console.log('set被调用了', value)
                box.innerHTML = value
            }
        })
    </script>


</body>

</html>